Component({
  properties: {
    uiShowSidebar: {
      type: Boolean,
      value: false
    },
    user: {
      type: Object,
      value: {}
    },
    service: {
      type: Object,
      value: {}
    }
  },
  data: {
  },
  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    ready() {
      // console.log('sidebar onLoad')
    },
    moved() { },
    detached() { },
  },
  methods: {
    handleRoute: global.handleRoute,
    handleLink(e){
      this.handleRoute(e)
      this.handleHide()
    },
    handleOpen(e) {
      this.triggerEvent('showSidebar')
    },
    handleHide(e) {
      this.triggerEvent('hideSidebar')
    },
    handleToogle(e) {
      this.triggerEvent('')
    },
    handleWaiter(e) {
      this.selectComponent('#pop').handleShow()
    },
    handleMakeCall(e){
      console.log('handleMakeCall', e)
      const { detail } = e
      if(detail && detail.mobile) {
        const phoneNumber = detail.mobile
        wx.makePhoneCall({
          phoneNumber,
          success(e){

          },
          fail(e){
            console.error(e)
            if(e.errMsg !== 'makePhoneCall:fail cancel') {
              console.error(e)
            }
          },
        })
      }
    }
  }
})
